<%--
  Created by IntelliJ IDEA.
  User: asd73
  Date: 2017/9/23
  Time: 15:07
  To change this template use File | Settings | File Templates.
--%>
<%--节点移动--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style type="text/css">

    </style>
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#moveB').click(function () {
                //$('div ul li').eq(0).insertAfter($('div ul li').eq(2));//将某个节点插入到另一个节点后
                $('#move ul li').eq(0).insertBefore($('div ul li').eq(2));

            });
            $('#replaceB').click(function (e) {
                //$('#replace').replaceWith('<h1>我是替换</h1>');//不会保留div
                $('#replace').html('<h1>我是替换</h1>');//会保留div盒子
            });
        })
    </script>
</head>
<body>
    <button id="moveB">点击移动</button>
    <div id="move">
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
        </ul>
    </div>
    <button id="replaceB">点击替换</button>
    <div id="replace">
        我是div
    </div>
</body>
</html>
